package com.wjerp.tplus.server.api.request;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;

/**
 * 基础的分页入参信息
 * @author lishuailei
 */
public class BaseRequestPage {
    @ApiModelProperty(value="页码")
    private Integer current = 1;
    @ApiModelProperty(value="每页记录数")
    private Integer pageSize = 10;

    @JsonIgnore
    @ApiModelProperty(value = "开始记录")
    private Integer start;

    public Integer getCurrent() {
        return  current == null ? 1 : current;
    }

    public void setCurrent(Integer current) {
        this.current = current;
    }

    public Integer getPageSize() {
        return  pageSize == null ? 10 : pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getStart() {
        return (getCurrent() - 1)*getPageSize();
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    @Override
    public String toString() {
        return "BaseRequestPage{" +
                "current=" + current +
                ", pageSize=" + pageSize +
                '}';
    }
}
